/*
一些性能测试相关的
可以生成一个trace.json的文件，供chrome控制台解析，await page.metrics()还可以给出一些性能测试的数据。
window.performance.timing
 */
const puppeteer = require('puppeteer');
(async () => {
    const browser = await puppeteer.launch({headless: false});
    const page = await browser.newPage();
    await page.tracing.start({path: 'trace.json'})
    await page.goto('http://www.baidu.com')
    await page.tracing.stop()
    const metrics = await page.metrics()
    console.log(metrics)
    await browser.close();
})();// output{ Timestamp: 27888.820538,
/*
Documents: 2,
    Frames: 1,
    JSEventListeners: 58,
    Nodes: 171,
    LayoutCount: 20,
    RecalcStyleCount: 26,
    LayoutDuration: 0.042335,
    RecalcStyleDuration: 0.010091,
    ScriptDuration: 0.124838,
    TaskDuration: 0.000039,
    JSHeapUsedSize: 6388448,
    JSHeapTotalSize: 10334208 }*/
